package com.kevms.phonewars;

import java.util.ArrayList;
import java.util.List;

import android.app.Application;

/** 
* @class PWApplication
* 
* @brief Application providing custom methods.
* 
* Application provides custom methods to be used in
* all Activities in the application.
*/ 
public class PWApplication extends Application {
	
	private String mOpenID;
	private String mSessionID;
	public List<Player> playerList;
	
	public PWApplication() {
		playerList = new ArrayList<Player>();
	}
	
	public String getOpenID() {
		return mOpenID;
	}
	
	public void setOpenID(String id) {
		mOpenID = id;
	}
	
	public String getSessionID() {
		return mSessionID;
	}
	
	public void setSessionID(String id) {
		mSessionID = id;
	}
	
	public List<Player> getPlayerList() {
		return playerList;
	}
	
	public Player findPlayer(int id) {
		for(Player p : playerList) {
			if(p.getId() == id) {
				return p;
			}
		}
		
		return null;
	}
	
	public void addPlayer(Player p) {
		playerList.add(p);
	}
	
	public void removePlayer(Player p) {
		playerList.remove(p);
	}
	
	public void clearPlayerList() {
		playerList.clear();
	}
}
